import { showWarningToast, jsonp } from '~utils'

export function getFund (code) {
  return new Promise((resolve, reject) => {
    jsonp(`https://fundgz.1234567.com.cn/js/${code}.js`, { name: 'jsonpgz' }).then(res => {
      resolve(res)
    }, err => {
      showWarningToast('找不到该基金，请输入正确的基金编码')
      reject(err)
    })
  })
}